<?php

/**
 * Question form base class.
 *
 * @package    form
 * @subpackage question
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 8807 2008-05-06 14:12:28Z fabien $
 */
class BaseQuestionForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'id_type_question' => new sfWidgetFormPropelSelect(array('model' => 'TypeQuestion', 'add_empty' => false)),
      'id_answer'        => new sfWidgetFormPropelSelect(array('model' => 'Alternative', 'add_empty' => false)),
      'name'             => new sfWidgetFormInput(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorPropelChoice(array('model' => 'Question', 'column' => 'id', 'required' => false)),
      'id_type_question' => new sfValidatorPropelChoice(array('model' => 'TypeQuestion', 'column' => 'id')),
      'id_answer'        => new sfValidatorPropelChoice(array('model' => 'Alternative', 'column' => 'id')),
      'name'             => new sfValidatorString(array('max_length' => 100)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Question', 'column' => array('name')))
    );

    $this->widgetSchema->setNameFormat('question[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Question';
  }


}
